<template>
    <div id="express">
        <van-nav-bar title="物流详情" left-arrow @click-left="back" />
        <section class="aui-flexView">
      <!-- 订单详细 -->
      <section class="aui-scrollView">
        <!-- 订单状态 -->
        <div class="aui-pay-change">
          <div class="aui-flex">
            <div class="aui-flex-box">
              <h3>{{express.status_text}}</h3>
            </div>
            <div class="aui-pay-zfb">
              <img src="/assets/images/icon-zfb.png" alt="" />
            </div>
          </div>
        </div>
  
        <!-- 收货地址 -->
        <div class="aui-flex">
          <div class="aui-flex-add">
            <img src="" alt="" />
          </div>
          <div class="aui-flex-box">
            <h3>{{ express.consignee }} <em>{{ express.mobile }}</em></h3>
          <p>{{ express.region_text }}</p>
          </div>
        </div>
        <!-- 物流信息 -->
        <van-steps direction="vertical" :active="0">
            <van-step :key="index" v-for="(item,index) in express.expressList">
                <h3>{{item.status}}</h3>
                <p>{{item.time}}</p>
            </van-step>
        </van-steps>
      </section>
    </section>
    </div>
</template>

<script setup>
    const {proxy} = getCurrentInstance();
    const back = () => proxy.$router.push("/order/index");

    onBeforeMount(()=>{
        getData()
    })

    const userInfo = proxy.$cookies.get("business")?proxy.$cookies.get("business"):{};
    const orderid = proxy.$route.query.orderid?proxy.$route.query.orderid:0
    let express = ref({})
    const getData = async () => {
         let data = {
            busid:userInfo.id,
            orderid:orderid
        }
        let result = await proxy.$POST({
            url:"/business/express",
            params:data
        })
        if(result.code){
            express.value = result.data
            if(!result.data.expressList){
              proxy.$fail(result.msg)
            }
            // express.value.expressList.reverse()
            return false
        }else{
            proxy.$fail(result.msg);
            return false
        }
    }
</script>

<style>
    @import url("/assets/css/info.css");
</style>